package com.ctbri.containerindepth;


class StringList {
	private int index = 0;
	private String[] arrays;
	private static final int INCR = 20;
	
	public StringList(){
		arrays = new String[10];
	}
	
	public StringList(int size) {
		arrays = new String[size];
	}
	
	public void add(String element) {
		if(index >= arrays.length) {
			String[] tmp = new String[arrays.length + INCR];
			for(int i = 0; i < arrays.length; i++) {
				tmp[i] = arrays[i];
			}
			arrays = tmp;
		}
		arrays[index++] = element;
	}
	
	public String get(int i ) {
		return arrays[i];
	}
	
	public int size() {
		return index;
	}
}
public class Ex31 {
	public static void main(String[] args) {
		
	}
}
